import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;

public class Test4 {
    public static void main(String[] args) {
        try(OutputStream outputStream = new FileOutputStream("f:/tt.txt") ;
            PrintWriter writer = new PrintWriter(outputStream);
        ) {
             //这里就相当于 把字节流 准成 字符流输出
             // 这里printf  的 就是输出到文件里了
             writer.printf("hello");
             writer.println("word");
            writer.flush(); //刷新缓冲区,
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
